<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_log')->create('log_ad_postback_regpay', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('媒体回传-注册并付费日志');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('convert_time')->comment('付费时间')->unsigned()->default(0);
            $table->integer('plan_id')->comment('计划id')->unsigned()->default(0);
            $table->bigInteger('myad_group_id')->comment('整合广告组id')->unsigned()->default(0);
            $table->bigInteger('myad_ad_id')->comment('整合广告id')->unsigned()->default(0);
            $table->bigInteger('myad_creative_id')->comment('整合创意id')->unsigned()->default(0);
            $table->integer('media_id')->comment('媒体id')->unsigned()->default(0);
            $table->integer('media_docking_id')->comment('媒体对接id')->unsigned()->default(0);
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->integer('channel')->comment('渠道id')->unsigned()->default(0);
            $table->integer('user_id')->comment('账号id')->unsigned()->default(0);
            $table->tinyInteger('is_post')->comment('是否回传 1是0否')->unsigned()->default(0);

            $table->index('convert_time');
            $table->index('plan_id');
            $table->index('media_id');
            $table->index('media_docking_id');
            $table->index('game_id');
            $table->index('channel');
            $table->index('user_id');
            $table->index('is_post');
            $table->index('myad_group_id');
            $table->index('myad_ad_id');
            $table->index('myad_creative_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_log')->dropIfExists('log_ad_postback_regpay');
    }
};
